let app = new Vue({
	el: "#main-content",
	data: {
		pageNum1 : "1",
		pageSize : 3,
		getList1 : "",
		goodsName : "",
		getGoodsName : ""
	},
	created() {
		this.getList()
	},
	methods:{
		getList(pageNum){
			if(pageNum>0){
				this.pageNum1=pageNum;
			}
			let data = new URLSearchParams;
			data.append("pageNum",this.pageNum1);
			data.append("pageSize",this.pageSize);
			data.append("goodsName",this.goodsName);
			axios({
				url : "cangku/storeManagementAll",
				method : "post",
				data : data,
				headers:{"token":localStorage.token,"url":window.location.pathname}
			}).then(response=>{
				this.getList1=response.data.data;
				console.log(this.getList1);
			})
		},
		storeManagementJiaJian(id,jia,jian){
			let data = new URLSearchParams;
			data.append("id",this.id);
			data.append("jia",jia);
			data.append("jian",jian);
			axios({
				url : "cangku/storeManagementJiaJian",
				method : "post",
				data : data,
				headers:{"token":localStorage.token,"url":window.location.pathname}
			}).then(response=>{
				console.log(response);
			})
		},
		add(){
			var person = prompt("请输入物品类别：");
			if (person == null || person == "") {
			 alert("取消操作");
			} else {
				let data = new URLSearchParams;
				data.append("goodsName",person);
				axios({
					url : "cangku/goodsNameAdd",
					method : "post",
					data : data,
					headers:{"token":localStorage.token,"url":window.location.pathname}
				}).then(response=>{
					if(response.data.data){
						this.getList();
						alert("添加成功");
					}else{
						alert("添加失败");
					}
				})
			}
		},
		delet(id){
			let data = new URLSearchParams;
			data.append("id",id);
			axios({
				url : "cangku/storeManagementDelet",
				method : "post",
				data : data,
				headers:{"token":localStorage.token,"url":window.location.pathname}
			}).then(response=>{
				var mymessage=confirm("确定删除？");
					if(mymessage==true)
					{               
						if(response.data.data){
							this.getList();
							alert("删除成功");
						}else{
							alert("删除失败,可能是还有出仓物品没有归还");
						}
					}
					else
					{
						alert("取消操作");
					}

				
			})
		},
		tianjia(id){
			location.href="addRepertory.html?id="+id;
		},
		
		
	}
})